package net.gd.domain;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import net.gd.utils.Constants;
import net.sf.json.JSONObject;

public class UdfModelLog {
  private String logId;
  private String operationUser;
  private String operationType;
  private String operationResult;
  private String operationStatus;
  private Date operationDatetime;
  private String modelId;
  private String langType;
  private String modelContent;

  public JSONObject toJson() {
    SimpleDateFormat df = new SimpleDateFormat(Constants.DATETIME_FORMAT);
    Map<String, String> map = new HashMap<>();
    map.put("model_id", this.modelId);
    map.put("log_id", this.logId);
    map.put("operation_user", this.operationUser);
    map.put("operation_result", this.operationResult);
    map.put("operation_status", this.operationStatus);
    map.put("operation_datetime",
        this.operationDatetime != null ? df.format(operationDatetime) : null);
    map.put("lang_type", langType);
    map.put("model_content", modelContent);
    return JSONObject.fromObject(map);
  }

  public String getOperationResult() {
    return operationResult;
  }

  public void setOperationResult(String operationResult) {
    this.operationResult = operationResult;
  }

  public String getLangType() {
    return langType;
  }

  public void setLangType(String langType) {
    this.langType = langType;
  }



  public String getLogId() {
    return logId;
  }

  public void setLogId(String logId) {
    this.logId = logId;
  }

  public String getOperationUser() {
    return operationUser;
  }

  public void setOperationUser(String operationUser) {
    this.operationUser = operationUser;
  }

  public String getOperationType() {
    return operationType;
  }

  public void setOperationType(String operationType) {
    this.operationType = operationType;
  }

  public String getOperationStatus() {
    return operationStatus;
  }

  public void setOperationStatus(String operationStatus) {
    this.operationStatus = operationStatus;
  }

  public String getModelId() {
    return modelId;
  }

  public void setModelId(String modelId) {
    this.modelId = modelId;
  }

  public Date getOperationDatetime() {
    return operationDatetime;
  }

  public void setOperationDatetime(Date operationDatetime) {
    this.operationDatetime = operationDatetime;
  }

  public String getModelContent() {
    return modelContent;
  }

  public void setModelContent(String modelContent) {
    this.modelContent = modelContent;
  }

  @Override
  public String toString() {
    return "UdfModelLog [logId=" + logId + ", operationUser=" + operationUser + ", operationType="
        + operationType + ", operationResult=" + operationResult + ", operationStatus="
        + operationStatus + ", operationDatetime=" + operationDatetime + ", modelId=" + modelId
        + ", langType=" + langType + ", modelContent=" + modelContent + "]";
  }
}
